import request from "axios"

  //获取唯一标示
  export function getImei() {
    return new Promise((resolve, reject) => {
      request({
        url: `http://www.adbubo.com/movie/v1/imei?channel=wx`,
        method: "GET",
      }).then((data) => {
        resolve(data)
      }).catch((data) => {
        reject(data)
      })
    });
  }
  //获取搜索历史
  export function getHistory(imei) {
    return new Promise((resolve, reject) => {
      request({
        url: `http://www.adbubo.com/movie/v1/history?imei=${imei}`,
        method: "GET",
      }).then((data) => {
        resolve(data)
      }).catch((data) => {
        reject(data)
      })
    });
  }
  //获取热门搜索
  export function getHotSearch(){
    return new Promise((resolve, reject) => {
      request({
        url: `http://www.adbubo.com/movie/v1/hotWork`,
        method: "GET",
      }).then((data) => {
        resolve(data)
      }).catch((data) => {
        reject(data)
      })
    });
  }
  //获取热门搜索
  export function search(name,imei){
    return new Promise((resolve, reject) => {
      request({
        url: `http://www.adbubo.com/movie/v1/back?imei=${imei}&key=${name}`,
        method: "GET",
      }).then((data) => {
        resolve(data)
      }).catch((data) => {
        reject(data)
      })
    });
  }
   //获取搜索，返回列表
   export function searchall(name){
    return new Promise((resolve, reject) => {
      request({
        url: `http://www.adbubo.com/movie/v1/keys?key=${name}`,
        method: "GET",
      }).then((data) => {
        resolve(data)
      }).catch((data) => {
        reject(data)
      })
    });
  }

